package com.pfsoft.controller;/**
 * @author PF
 * Created by dell on 2018-03-22.
 */

import com.pfsoft.Vo.BaseResponse;
import com.pfsoft.models.Article;
import com.pfsoft.service.IArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * com.pfsoft.controller
 *
 * @author PF
 * @create 2018-03-22 11:23
 **/
@Controller
public class ArticleController {

    @Autowired
    private IArticleService articleService;



    @RequestMapping(value = "/articles")
    public  @ResponseBody BaseResponse<List<Article>> getArticles() {
        BaseResponse<List<Article>> response = new BaseResponse<>();
        response.setData(articleService.getArticle());
        response.setRetCode(HttpStatus.OK.value());
        response.setRetMsg(HttpStatus.OK.name());
        return response;
    }

}
